package com.okaixz.client.controller;


import com.okaixz.client.model.dto.OrderInfoDto;
import com.okaixz.client.model.dto.UserDto;
import com.okaixz.client.service.IOrderInfoService;
import com.okaixz.common.client.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author cdz
 * @since 2024-10-17
 */
@RestController
@RequestMapping("/order")
public class OrderInfoController {
    @Autowired
    private IOrderInfoService orderInfoService;
    @GetMapping("/list/{userId}")
    public Result<List<OrderInfoDto>> getListByUserId(@PathVariable String userId){
        List<OrderInfoDto> list = orderInfoService.getListByUserId(userId);
        return Result.success(list);
    }
    @GetMapping("queryWxAppPay/{id}")
    public Result<UserDto> getById(@PathVariable String id){
        UserDto userDto = orderInfoService.queryWxAppPayOrder(id);
        return Result.success(userDto);
    }
//    @GetMapping("/save")
//    public Result<OrderInfo> save(){
//        OrderInfo order = orderInfoService.createOrder("userId", 1);
//        return Result.success(order);
//    }
}
